<template>
  <div class="error-container">
    <div class="error-content">
      <div class="error-image">
        <el-icon size="120" color="#409eff">
          <Warning />
        </el-icon>
      </div>
      
      <div class="error-info">
        <h1 class="error-code">404</h1>
        <h2 class="error-title">页面不存在</h2>
        <p class="error-description">
          抱歉，您访问的页面不存在或已被移除。
        </p>
        
        <div class="error-actions">
          <el-button type="primary" size="large" @click="goHome">
            <el-icon><House /></el-icon>
            返回首页
          </el-button>
          <el-button size="large" @click="goBack">
            <el-icon><Back /></el-icon>
            返回上页
          </el-button>
        </div>
      </div>
    </div>
    
    <div class="error-footer">
      <p>如果您认为这是一个错误，请联系系统管理员</p>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { Warning, House, Back } from '@element-plus/icons-vue'

const router = useRouter()

const goHome = () => {
  router.push('/')
}

const goBack = () => {
  router.go(-1)
}
</script>

<style lang="scss" scoped>
.error-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 20px;
  
  .error-content {
    text-align: center;
    max-width: 600px;
    
    .error-image {
      margin-bottom: 30px;
      animation: float 3s ease-in-out infinite;
    }
    
    .error-info {
      .error-code {
        font-size: 120px;
        font-weight: bold;
        color: #409eff;
        margin: 0;
        line-height: 1;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
      }
      
      .error-title {
        font-size: 32px;
        color: #333;
        margin: 20px 0 10px 0;
        font-weight: 600;
      }
      
      .error-description {
        font-size: 16px;
        color: #666;
        margin: 0 0 40px 0;
        line-height: 1.6;
      }
      
      .error-actions {
        display: flex;
        gap: 16px;
        justify-content: center;
        flex-wrap: wrap;
        
        .el-button {
          min-width: 120px;
        }
      }
    }
  }
  
  .error-footer {
    margin-top: 60px;
    text-align: center;
    
    p {
      font-size: 14px;
      color: #999;
      margin: 0;
    }
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

// 响应式设计
@media (max-width: 768px) {
  .error-container {
    .error-content {
      .error-info {
        .error-code {
          font-size: 80px;
        }
        
        .error-title {
          font-size: 24px;
        }
        
        .error-description {
          font-size: 14px;
        }
        
        .error-actions {
          flex-direction: column;
          align-items: center;
          
          .el-button {
            width: 200px;
          }
        }
      }
    }
  }
}

@media (max-width: 480px) {
  .error-container {
    .error-content {
      .error-image {
        .el-icon {
          font-size: 80px !important;
        }
      }
      
      .error-info {
        .error-code {
          font-size: 60px;
        }
        
        .error-title {
          font-size: 20px;
        }
      }
    }
  }
}

// 暗色主题适配
html.dark {
  .error-container {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    
    .error-content {
      .error-info {
        .error-title {
          color: #fff;
        }
        
        .error-description {
          color: #ccc;
        }
      }
    }
    
    .error-footer {
      p {
        color: #666;
      }
    }
  }
}
</style>